﻿using System;
using System.Linq.Expressions;
using System.Web.Mvc;

namespace Avalon.Core.MVC.Attributes
{
    public class DetailNavigationAttribute : Attribute, IMetadataAware
    {
        public const string Key = "DetailNavigation";

        public string PropertyName { get; set; }

        public DetailNavigationAttribute(string propertyName)
        {
            PropertyName = propertyName;
        }

        public void OnMetadataCreated(ModelMetadata metadata)
        {
            metadata.AdditionalValues[Key] = PropertyName;
        }
    }
}
